Skip to content

Add in ByCode support of all type mappings on Id #1848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

fredericDelaporte
Copy link
Member

@fredericDelaporte fredericDelaporte commented Sep 14, 2018

Mapping by code does not currently allow to set a parameterized type on ids.
This is an undue limitation, which may cause issues to users of custom types, and may also hinder usage of #1844 with mapping by code.

Having checked the xsd, this was the only case lacking full type specification possibilities in by-code. The type element is used on element, property, key-property and id. By code was already allowing to define parameters on the three former.

//void Type<TPersistentType>(object parameters) where TPersistentType : IIdentifierType;
//void Type(System.System.Type persistentType, object parameters);
//void Column(Action<IColumnMapper> columnMapper);
//void Columns(params Action<IColumnMapper>[] columnMapper);
Copy link
Member Author

@fredericDelaporte fredericDelaporte Sep 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The column methods are not lacking, they are here through inherited IColumnsMapper.

.Type<TPersistentType>(parameters);
}

public static void Type(this IIdMapper idMapper, System.Type persistentType, object parameters)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it the only method that needs to be added to interface? I think it's better to keep other methods as extensions and inline them.

@@ -66,6 +67,38 @@ public void Type(IIdentifierType persistentType)
}
}

public void Type(System.Type persistentType, object parameters)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a(!) future I would like to have a method which accepts IDictionary<string, object> for parameters.

@fredericDelaporte fredericDelaporte merged commit 233c3b4 into nhibernate:master Sep 17, 2018
@fredericDelaporte fredericDelaporte deleted the ByCodeParameterizedIdType branch September 17, 2018 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants